package com.lx.oms.controller.controller;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lx.oms.common.annotation.SysLog;
import com.lx.oms.common.controller.AbstractController;
import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.R;
import com.lx.oms.controller.entity.JoinEntity;
import com.lx.oms.controller.service.JoinService;

/**
 * 加盟申请
 *
 * @author houzhong
 * @date 2018年11月15日 下午3:42:52
 */
@RestController
@RequestMapping("/sys/join")
public class JoinController extends AbstractController {
	
	@Autowired
	private JoinService joinService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<JoinEntity> list(@RequestBody Map<String, Object> params) {
		return joinService.listJoin(params);
	}
		
	/**
	 * 新增
	 * @param tJoin
	 * @return
	 */
	@SysLog("新增加盟申请")
	@RequestMapping("/save")
	public R save(@RequestBody JoinEntity tJoin) {
		return joinService.saveJoin(tJoin);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody String id) {
		return joinService.getJoinById(new BigInteger(id));
	}
	
	/**
	 * 修改
	 * @param tJoin
	 * @return
	 */
	@SysLog("修改加盟申请")
	@RequestMapping("/update")
	public R update(@RequestBody JoinEntity tJoin) {
		return joinService.updateJoin(tJoin);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除加盟申请")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody String[] id) {
		return joinService.batchRemove(id);
	}
	
}
